<?php $this->pageTitle = Yii::app()->user->name; ?>
<div class="c_body">
	<div class="cat_head">
		<div class="cat_head_strip"></div>
		<a href="<?php echo Yii::app()->createUrl('albums/index', array('profile'=>Yii::app()->request->getParam('profile'))); ?>" class="cat_head_btn_r r_m">
			<div class="cat_head_btn_l">Альбомы</div>
		</a>
		<div class="cat_head_h"><p class="cat_head_h_txt"><span><?php echo $photos; ?></span> фотографии в <span><?php echo $albums; ?></span> альбомах </p></div>
	</div>
	<div class="cat_list_block commentsblocks">
		<?php foreach($comments as $key=>$comment){ ?>	
		<div class="u_buzz_item">
			<div class="u_buzz_item_l">
				<a href="<?php echo Yii::app()->createUrl('profile/index', array('id'=>$comment->user_id));?>">
					<?php if($comment->user->avatar_info){ ?>
						<?php echo $this->material_image(0, $comment->user->avatar_info->name, '50', 'photos/'. $comment->user->id . '/' . 0); ?>
					<?php }else{ ?>
						<?php echo $this->material_image(0, 'noimage.gif', '50', ''); ?>
					<?php } ?>					
				</a>
			</div>
			<div class="u_buzz_item_r">
				<div class="u_buzz_name">
						<a href="<?php echo Yii::app()->createUrl('profile/index', array('id'=>$comment->user->id));?>">
							<?php echo CHtml::encode($comment->user->full_name); ?>
						</a>
						<?php $date_diff = date_diff(date_create($comment->crdate), date_create()); ?>
						<?php if($date_diff->h){ ?>
							<span class="u_buzz_date"><?php echo Yii::app()->dateFormatter->formatDateTime($comment->crdate, 'long','short'); ?></span>
						<?php }else{ ?>
							<span class="u_buzz_date"><?php echo $date_diff->i; ?> мин. назад</span>
						<?php } ?>
					<div class="u_buzz_link_block hidden">
						<?php if(($comment->user->id == Yii::app()->user->id) || (Yii::app()->user->id == Yii::app()->request->getParam('profile'))){ ?>
							<a href="<?php echo Yii::app()->createAbsoluteUrl("albums/deletecomment", array('comment_id'=>$comment->id)); ?>" class="u_buzz_link l2 comment_delete" onclick="return false;">
								<div class="user_action_item_tooltip c hidden"><div class="cc">Удалить сообщение</div></div>
							</a>
						<?php } ?>
					</div>
				</div>
				<div class="commentContent">
					<p class="u_buzz_text"><?php echo nl2br(CHtml::encode(rawurldecode($comment->text))); ?></p>
					<span class="previewImage">
						<a href="<?php echo Yii::app()->createUrl('albums/photo', array('id'=>$comment->photo->id,'profile'=>Yii::app()->request->getParam('profile')));?>" class="photoBg photoBgLtl">
							<?php echo $this->material_image($comment->photo->id, $comment->photo->name, '100', 'photos/'.$comment->photo->user_id.'/'.$comment->photo->album->id); ?>
						</a>
					</span>
				</div>
			</div>
		</div>
	<?php } ?>
	</div>
	<div class="clear"></div>
</div>
